package com.zlx.xbhy.mapper;

import com.zlx.xbhy.entity.Article;
import com.zlx.xbhy.entity.Meeting;
import com.zlx.xbhy.mapper.provider.MeetingSqlProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

/**
 * @ClassName MeetingMapper
 * @Description TODO
 * @Author Edward
 * @Date 2020/11/22 15:29
 */
public interface MeetingMapper extends Mapper<Meeting> {
//    @Select("SELECT * FROM meeting WHERE title LIKE CONCAT('%',#{title},'%')")
    @SelectProvider(type = MeetingSqlProvider.class,method = "seletePage")
    public List<Meeting> selectPage(@Param("title") String title,@Param("status") Integer status);

    @Select("SELECT * FROM `meeting`")
    public List<Meeting> selectAlls();

    @Select("SELECT " +
            "COUNT( 1 ) count, " +
            "DATE_FORMAT( DATE_SUB( NOW(), INTERVAL ${day} DAY ), '%m-%d' ) nowDate  " +
            "FROM " +
            "`meeting`  " +
            "WHERE " +
            "to_days( " +
            "now()) - to_days( publish_date )= #{day}")
    Meeting countNew(Integer day);
}
